<cfcomponent extends="queries">
    
	<!--- Employee Search --->
    <cffunction name="funcEmployeeSearch" returntype="query">
    	<cfargument default="" name="SearchString" type="string" />
        
        <cfquery datasource="#Session.DataSource#" name="qryEmployeeSearch">
            SELECT *
            FROM(SELECT id 
                   ,first
                   ,last
                   ,preferredname
                   ,ssn
            FROM Employee)a
            WHERE [last] like  <cfqueryparam value="%#ARGUMENTS.SearchString#%" cfsqltype="cf_sql_varchar" />
            or first like  <cfqueryparam value="%#ARGUMENTS.SearchString#%" cfsqltype="cf_sql_varchar" />
            or preferredname like  <cfqueryparam value="%#ARGUMENTS.SearchString#%" cfsqltype="cf_sql_varchar" />
            or ssn =  <cfqueryparam value="%#ARGUMENTS.SearchString#%" cfsqltype="cf_sql_varchar" />
            or first + ' ' + [last] =  <cfqueryparam value="%#ARGUMENTS.SearchString#%" cfsqltype="cf_sql_varchar" />
            order by last, first
		</cfquery>
        
    	<cfreturn qryEmployeeSearch />
    </cffunction>
    <!--- Employee Search --->
    
    
    
    <!--- Employee Search Results --->
    <cffunction name="funcEmployeeSearchResults" returntype="query">
    	<cfargument default="" name="ID" type="string" />
        
        <cfquery name="qryEmployeeSearchResults" datasource="#Session.DataSource#">
            SELECT ID, [First], PreferredName, Middle, [Last], HomePhone, CellPhone, WorkPhone,
                WorkPhoneExt, PhonePrimaryID, Email, Address1, Address2, City, [State], ZIP,
                ContainerID, PostingID, PositionID, SupervisorID, DeptID, BadgeAccessLevelID,
                MirrorAccountID, DeskPhone, TimeCardApprs, EstStartDate, ActStartDate, Exempt,
                Seasonal, [Primary], SalaryHourlyID, WorkersCompID, CompTypeID, FrequencyID,
                EmpCodeID, FullTime, HoursPerWeek, PayRate, OfferAccepted, DOB, SSN, I9,
                MaritalStatusID, GenderID, EthnicID, OrientationNoShow, BadgeID, CostCode,
                Benifits, Leave, LunchID, NonSCFTypeID, NonSCFNetworkAccount, NonSCFBadge,
                CompanyName, ExpDate, BadgePos, ShiftID, Daily
            FROM Employee	
            WHERE id = <cfqueryparam value="#ARGUMENTS.ID#" cfsqltype="cf_sql_integer" />
        </cfquery>
        
    	<cfreturn qryEmployeeSearchResults />
    </cffunction>
    <!--- Employee Search Results --->
    
    
    
    <!--- Employee Steps --->
    <cffunction name="funcEmployeeSteps" returntype="query">
    	<cfargument default="" name="ID" type="string" />
        
        <cfquery name="qryEmployeeSteps" datasource="#Session.DataSource#">
            SELECT StepActions.ID,
                   EmployeeID,
                   TermReqID,
                   StepID,
                   S.StepDesc,
                   S.OrderNo,
                   CreationTimeStamp,
                   ActionByID,
                   ActTimeStamp,
                   Notes
            FROM StepActions
            INNER JOIN steps S on S.ID = StepActions.StepID
            WHERE S.orderno < 100
            AND EmployeeID = <cfqueryparam value="#ARGUMENTS.ID#" cfsqltype="cf_sql_integer" />
        </cfquery>
        
    	<cfreturn qryEmployeeSteps />
    </cffunction>
    <!--- Employee Steps --->
    
       
</cfcomponent>